---
layout: m1x_rest
title: Product Websites
---


<ul class="introduction-menu">
    <li><a href='#RESTAPI-Resource-ProductWebsites-RESTAPI-ProductWebsites'>REST API: Product Websites</a>
    <ul>
        <li><a href='#RESTAPI-Resource-ProductWebsites-URI--products--productid-websites'>URI: /products/:product_id/websites</a>
        <ul>
            <li><a href='#RESTAPI-Resource-ProductWebsites-HTTPMethod-GET'>HTTP Method: GET</a></li>
            <li><a href='#RESTAPI-Resource-ProductWebsites-HTTPMethod-POST'>HTTP Method: POST</a>
            <ul>
                <li><a href='#RESTAPI-Resource-ProductWebsites-WebsiteAssignment'>Website Assignment</a></li>
                <li><a href='#RESTAPI-Resource-ProductWebsites-WebsiteAssignmentwithProductDataCopying'>Website Assignment with Product Data Copying</a></li>
                <li><a href='#RESTAPI-Resource-ProductWebsites-MultiWebsiteAssignment'>Multi-Website Assignment</a></li>
                <li><a href='#RESTAPI-Resource-ProductWebsites-MultiWebsiteAssignmentwithProductDataCopying'>Multi-Website Assignment with Product Data Copying</a></li>
            </ul>
            </li>
        </ul>
        </li>
        <li><a href='#RESTAPI-Resource-ProductWebsites-URI--products--productid-websites--websiteid'>URI: /products/:product_id/websites/:website_id</a>
        <ul>
            <li><a href='#RESTAPI-Resource-ProductWebsites-HTTPMethod-DELETE'>HTTP Method: DELETE</a></li>
        </ul>
        </li>
    </ul>
    </li>
    <li><a href='#RESTAPI-Resource-ProductWebsites-PossibleHTTPStatusCodes'>Possible HTTP Status Codes</a></li>
</ul>


<h3><a name="RESTAPI-Resource-ProductWebsites-RESTAPI-ProductWebsites"></a>REST API: Product Websites</h3>

<h4><a name="RESTAPI-Resource-ProductWebsites-URI--products--productid-websites"></a>URI: /products/:product_id/websites</h4>

<p>Allows you to retrieve information about websites assigned to a product, assign a website to a product, and copy data for a product from a specified store view.</p>

<p><b>URL Structure</b>: <a href="http://magentohost/api/rest/products/:product_id/websites">http://magentohost/api/rest/products/:product_id/websites</a><br/>
<b>Version</b>: 1</p>

<h5><a name="RESTAPI-Resource-ProductWebsites-HTTPMethod-GET"></a>HTTP Method: GET</h5>

<p><b>描述</b>: Allows you to retrieve information about websites assigned to the specified product.</p>


<p><b>Authentication</b>: Admin<br/>
<b>Default Format</b>: XML<br/>
<b>Parameters</b>:<br/>
<em>No Parameters</em></p>

<p><b>Example:</b></p>

<div class='panelMacro'><table class='infoMacro'><tr><td>GET <a href="http://magentohost/api/rest/products/8/websites">http://magentohost/api/rest/products/8/websites</a></td></tr></table></div>

<p><b>Response Body:</b></p>
<div class="panel" style="border-width: 1px;"><div class="panelContent">
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: java; gutter: false">&lt;?xml version="1.0"?&gt;
&lt;magento_api&gt;
  &lt;data_item&gt;
    &lt;website_id&gt;2&lt;/website_id&gt;
  &lt;/data_item&gt;
&lt;/magento_api&gt;</pre>
		</div>
</div></div>
</div></div>



<h5><a name="RESTAPI-Resource-ProductWebsites-HTTPMethod-POST"></a>HTTP Method: POST</h5>


<h6><a name="RESTAPI-Resource-ProductWebsites-WebsiteAssignment"></a>Website Assignment</h6>

<p><b>描述</b>: Allows you to assign a website to a specified product.</p>


<p><b>Authentication</b>: Admin<br/>
<b>Default Format</b>: XML<br/>
<b>Parameters</b>:</p>


<table><tbody>
<tr>
<th> Name </th>
<th> Description </th>
<th> Required </th>
<th> Type </th>
<th> Example Value </th>
</tr>
<tr>
<td> website_id </td>
<td> The website ID </td>
<td> required </td>
<td> int </td>
<td> 2 </td>
</tr>
</tbody></table>



<p><b>Example:</b></p>

<div class='panelMacro'><table class='infoMacro'><tr><td>POST <a href="http://magentohost/api/rest/products/8/websites">http://magentohost/api/rest/products/8/websites</a></td></tr></table></div>

<p><b>Request Body:</b></p>
<div class="panel" style="border-width: 1px;"><div class="panelContent">
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: java; gutter: false">&lt;?xml version="1.0"?&gt;
&lt;magento_api&gt;
    &lt;website_id&gt;1&lt;/website_id&gt;
&lt;/magento_api&gt;</pre>
		</div>
</div></div>
</div></div>

<p><b>Response Body:</b></p>

<div class="panel" style="border-width: 1px;"><div class="panelContent">
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: java; gutter: false">&lt;?xml version="1.0"?&gt;
&lt;magento_api&gt;
  &lt;success&gt;
    &lt;data_item&gt;
      &lt;website_id&gt;1&lt;/website_id&gt;
      &lt;product_id&gt;8&lt;/product_id&gt;
      &lt;message&gt;Resource updated successful.&lt;/message&gt;
      &lt;code&gt;200&lt;/code&gt;
    &lt;/data_item&gt;
  &lt;/success&gt;
&lt;/magento_api&gt;</pre>
		</div>
</div></div>
</div></div>


<p><br class="atl-forced-newline" />
<br class="atl-forced-newline" /></p>

<h6><a name="RESTAPI-Resource-ProductWebsites-WebsiteAssignmentwithProductDataCopying"></a>Website Assignment with Product Data Copying </h6>

<p><b>描述</b>: Allows you to assign a website and copy product data from the attached store to the one being attached. Only product data that is set on the Store View level is copied. All other data set on the Website or Global levels is not copied.</p>


<p><b>Authentication</b>: Admin<br/>
<b>Default Format</b>: XML<br/>
<b>Parameters</b>:</p>


<table><tbody>
<tr>
<th> Name </th>
<th> Description </th>
<th> Required </th>
<th> Type </th>
<th> Example Value </th>
</tr>
<tr>
<td> website_id </td>
<td> The website ID </td>
<td> required </td>
<td> int </td>
<td> 2 </td>
</tr>
<tr>
<td> store_from </td>
<td> The store ID from which data will be copied </td>
<td> required </td>
<td> int </td>
<td> 1 </td>
</tr>
<tr>
<td> store_to </td>
<td> The store ID to which data will be copied </td>
<td> required </td>
<td> int </td>
<td> 2 </td>
</tr>
</tbody></table>


<p><b>Notes:</b> The store_to parameter must belong to the website which we want to assign to a product.</p>

<p><b>Example:</b></p>

<div class='panelMacro'><table class='infoMacro'><tr><td>POST <a href="http://magentohost/api/rest/products/8/websites">http://magentohost/api/rest/products/8/websites</a></td></tr></table></div>

<p><b>Request Body:</b></p>
<div class="panel" style="border-width: 1px;"><div class="panelContent">
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: java; gutter: false">&lt;?xml version="1.0"?&gt;
&lt;magento_api&gt;
     &lt;website_id&gt;2&lt;/website_id&gt;
      &lt;copy_to_stores&gt;
          &lt;data_item&gt;
               &lt;store_from&gt;1&lt;/store_from&gt;
               &lt;store_to&gt;2&lt;/store_to&gt;
           &lt;/data_item&gt;
      &lt;/copy_to_stores&gt;
&lt;/magento_api&gt;</pre>
		</div>
</div></div>
</div></div>


<p><br class="atl-forced-newline" />
<br class="atl-forced-newline" /></p>



<h6><a name="RESTAPI-Resource-ProductWebsites-MultiWebsiteAssignment"></a>Multi-Website Assignment</h6>

<p><b>描述</b>: Allows you to assign multiple websites to a product.</p>


<p><b>Authentication</b>: Admin<br/>
<b>Default Format</b>: XML<br/>
<b>Parameters</b>:</p>


<table><tbody>
<tr>
<th> Name </th>
<th> Description </th>
<th> Required </th>
<th> Type </th>
<th> Example Value </th>
</tr>
<tr>
<td> website_id </td>
<td> The website ID </td>
<td> required </td>
<td> int </td>
<td> 2 </td>
</tr>
</tbody></table>



<p><b>Example:</b></p>

<div class='panelMacro'><table class='infoMacro'><tr><td>POST <a href="http://magentohost/api/rest/products/8/websites">http://magentohost/api/rest/products/8/websites</a></td></tr></table></div>

<p><b>Request Body:</b></p>
<div class="panel" style="border-width: 1px;"><div class="panelContent">
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: java; gutter: false">&lt;?xml version="1.0"?&gt;
&lt;magento_api&gt;
  &lt;data_item&gt;
    &lt;website_id&gt;1&lt;/website_id&gt;
  &lt;/data_item&gt;
  &lt;data_item&gt;
    &lt;website_id&gt;3&lt;/website_id&gt;
  &lt;/data_item&gt;
&lt;/magento_api&gt;</pre>
		</div>
</div></div>
</div></div>

<p><b>Response Body:</b></p>

<div class="panel" style="border-width: 1px;"><div class="panelContent">
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: java; gutter: false">&lt;?xml version="1.0"?&gt;
&lt;magento_api&gt;
  &lt;success&gt;
    &lt;data_item&gt;
      &lt;website_id&gt;1&lt;/website_id&gt;
      &lt;product_id&gt;8&lt;/product_id&gt;
      &lt;message&gt;Resource updated successful.&lt;/message&gt;
      &lt;code&gt;200&lt;/code&gt;
    &lt;/data_item&gt;
    &lt;data_item&gt;
      &lt;website_id&gt;3&lt;/website_id&gt;
      &lt;product_id&gt;8&lt;/product_id&gt;
      &lt;message&gt;Resource updated successful.&lt;/message&gt;
      &lt;code&gt;200&lt;/code&gt;
    &lt;/data_item&gt;
  &lt;/success&gt;
&lt;/magento_api&gt;</pre>
		</div>
</div></div>
</div></div>


<p><br class="atl-forced-newline" />
<br class="atl-forced-newline" /></p>

<h6><a name="RESTAPI-Resource-ProductWebsites-MultiWebsiteAssignmentwithProductDataCopying"></a>Multi-Website Assignment with Product Data Copying</h6>

<p><b>描述</b>: Allows you to assign multiple websites to a product together with copying product data from the attached store to the one being attached. Only product data that is set on the Store View level is copied. All other data set on the Website or Global levels is not copied.</p>


<p><b>Authentication</b>: Admin<br/>
<b>Default Format</b>: XML<br/>
<b>Parameters</b>:</p>


<table><tbody>
<tr>
<th> Name </th>
<th> Description </th>
<th> Required </th>
<th> Type </th>
<th> Example Value </th>
</tr>
<tr>
<td> website_id </td>
<td> The website ID </td>
<td> required </td>
<td> int </td>
<td> 2 </td>
</tr>
<tr>
<td> store_from </td>
<td> The store ID from which data will be copied </td>
<td> required </td>
<td> int </td>
<td> 1 </td>
</tr>
<tr>
<td> store_to </td>
<td> The store ID to which data will be copied </td>
<td> required </td>
<td> int </td>
<td> 2 </td>
</tr>
</tbody></table>


<p><b>Example:</b></p>

<div class='panelMacro'><table class='infoMacro'><tr><td>POST <a href="http://magentohost/api/rest/products/8/websites">http://magentohost/api/rest/products/8/websites</a></td></tr></table></div>

<p><b>Request Body:</b></p>
<div class="panel" style="border-width: 1px;"><div class="panelContent">
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: java; gutter: false">&lt;?xml version="1.0"?&gt;
&lt;magento_api&gt;
    &lt;data_item&gt;
        &lt;website_id&gt;2&lt;/website_id&gt;
        &lt;copy_to_stores&gt;
            &lt;data_item&gt;
                &lt;store_from&gt;1&lt;/store_from&gt;
                &lt;store_to&gt;2&lt;/store_to&gt;
            &lt;/data_item&gt;
        &lt;/copy_to_stores&gt;
    &lt;/data_item&gt;
    &lt;data_item&gt;
        &lt;website_id&gt;3&lt;/website_id&gt;
        &lt;copy_to_stores&gt;
            &lt;data_item&gt;
                &lt;store_from&gt;1&lt;/store_from&gt;
                &lt;store_to&gt;5&lt;/store_to&gt;
            &lt;/data_item&gt;
        &lt;/copy_to_stores&gt;
    &lt;/data_item&gt;
&lt;/magento_api&gt;</pre>
		</div>
</div></div>
</div></div>

<p><b>Response Body:</b></p>

<div class="panel" style="border-width: 1px;"><div class="panelContent">
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: java; gutter: false">&lt;?xml version="1.0"?&gt;
&lt;magento_api&gt;
  &lt;success&gt;
    &lt;data_item&gt;
      &lt;website_id&gt;2&lt;/website_id&gt;
      &lt;product_id&gt;8&lt;/product_id&gt;
      &lt;message&gt;Resource updated successful.&lt;/message&gt;
      &lt;code&gt;200&lt;/code&gt;
    &lt;/data_item&gt;
    &lt;data_item&gt;
      &lt;website_id&gt;3&lt;/website_id&gt;
      &lt;product_id&gt;8&lt;/product_id&gt;
      &lt;message&gt;Resource updated successful.&lt;/message&gt;
      &lt;code&gt;200&lt;/code&gt;
    &lt;/data_item&gt;
  &lt;/success&gt;
&lt;/magento_api&gt;</pre>
		</div>
</div></div>
</div></div>



<p><br class="atl-forced-newline" />
<br class="atl-forced-newline" /></p>




<h4><a name="RESTAPI-Resource-ProductWebsites-URI--products--productid-websites--websiteid"></a>URI: /products/:product_id/websites/:website_id</h4>

<p>Allows you to unassign a website from a specified product.</p>

<p><b>URL Structure</b>: <a href="http://magentohost/api/rest/products/:product_id/websites/:website_id">http://magentohost/api/rest/products/:product_id/websites/:website_id</a><br/>
<b>Version</b>: 1</p>

<h5><a name="RESTAPI-Resource-ProductWebsites-HTTPMethod-DELETE"></a>HTTP Method: DELETE</h5>

<p><b>描述</b>: Allows you to unassign a website from a specified product.</p>


<p><b>Authentication</b>: Admin<br/>
<b>Default Format</b>: XML<br/>
<b>Parameters</b>:<br/>
<em>No Parameters</em></p>

<p><b>Example:</b></p>

<div class='panelMacro'><table class='infoMacro'><tr><td>DELETE <a href="http://magentohost/api/rest/products/8/websites/1">http://magentohost/api/rest/products/8/websites/1</a></td></tr></table></div>



<h3><a name="RESTAPI-Resource-ProductWebsites-PossibleHTTPStatusCodes"></a>Possible HTTP Status Codes</h3>


<table><tbody>
<tr>
<th> Status Code </th>
<th> Message </th>
<th> Description </th>
</tr>
<tr>
<td> 404 </td>
<td> Product not found </td>
<td> The specified product is not found or does not exist. </td>
</tr>
<tr>
<td> 404 </td>
<td> Website not found </td>
<td> The specified website is not found or does not exist. </td>
</tr>
<tr>
<td> 400 </td>
<td> Invalid value for "store_from" for the website with ID &lt;ID value&gt;. </td>
<td> The entered value for "store_from" is not valid. </td>
</tr>
<tr>
<td> 400 </td>
<td> Invalid value for "store_to" for the website with ID &lt;ID value&gt;. <br class="atl-forced-newline" /> </td>
<td> The entered value for "store_to" is not valid. </td>
</tr>
<tr>
<td> 400 </td>
<td> Store not found &lt;store ID&gt; for website &lt;website ID&gt;. </td>
<td> The specified store is not found or does not exist. </td>
</tr>
<tr>
<td> 400 </td>
<td> Store &lt;store ID&gt; from which we will copy the information does not belong to the product &lt;product ID&gt; being edited. </td>
<td> The specified store is not assigned to the product. </td>
</tr>
<tr>
<td> 400 </td>
<td> Store &lt;store ID&gt; to which we will copy the information does not belong to the website &lt;website ID&gt; being added. </td>
<td> The specified store does not belong to the website. </td>
</tr>
<tr>
<td> 400 </td>
<td> Product &lt;product ID&gt; isn't assigned to website &lt;website ID&gt;. </td>
<td> The specified product is not assigned to the website. </td>
</tr>
<tr>
<td> 400 </td>
<td> Invalid value for "website_id" in request. </td>
<td> The value for "website_id" is not valid. </td>
</tr>
</tbody></table>



<?php include(__ROOT__ . 'footer.php'); ?>		    
